home *** CD-ROM | disk | FTP | other *** search
- ; a0 - source string
-
- xdef _DupStr
-
- _DupStr movem.l d2/a2/a6,-(a7)
-
- movea.l a0,a2 ; store str
- move.l a0,d1
- .loop1 tst.b (a0)+
- bne.s .loop1
- move.l a0,d0
- sub.l d1,d0 ; source string length
-
- addq.l #4,d0 ; add header and zero byte
- move.l d0,d2
- move.l #$50000,d1 ; MEMF_CLEAR|MEMF_REVERSE
- movea.l $4.w,a6
- jsr (-198,a6) ; AllocMem
- tst.l d0
- beq.s .finish
- addq.l #2,d0 ; shift by header
- movea.l d0,a1
- move.w d2,(-2,a1) ; this is private, and can be used only with RemStr()
- move a1,d0
-
- .loop move.b (a2)+,(a1)+ ; copy src to dst
- beq.s .finish
- dbf.s d2,.loop
- clr.b (-1,a1)
-
- .finish movem.l (a7)+,d2/a2/a6
- rts
-